; local.asm
; Test for the lib tool with local references only.

	.export main

STROUT			= $CB1E

	.segment "ZEROPAGE"
	
ptr:		.res 2

	.segment "RODATA"
	
hello_text:	.byte "hello world", 0

	.segment "DATA"

hello_ptr:	.byte <hello_text, >hello_text

	.segment "CODE"
	
main:		jsr hello
			jsr waitkey
			rts

hello:		lda #<hello_ptr
			sta ptr
			lda #>hello_ptr
			sta ptr+1
			ldy #0
			lda (ptr),y
			tax
			iny
			lda (ptr), y
			tay
			txa
			jmp STROUT

waitkey:	lda 198
			beq waitkey
			lda #0
			sta 198
			rts
